<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@include file="/WEB-INF/base.jspf"%>
<!DOCTYPE html>
<html>
<head>
<title>手机端页面管理</title>
<style>
	.nav{
		display:flex;
		justify-content: center;
	}
	
	#new{
		width:15%;
		text-align: center;
		background: #555;
		color: #fff;
		padding:5px;
		cursor: pointer;
		margin-top:20px;
	}
	
	#type-list ul li span{
		font-size:14px;
	}

	.div-c-init{
		padding-top:30px;
	}
	.div-c-table {
		display:none;
		padding-top:16px;
	}
	.div-c-table-active {
		display:block;
	}
		.modal-dialog {
		max-width: 1000px;
	}
	.control-btns button + button {
		margin-left:10px;
	}
	table th,table tr,table td {
		text-align: center;
		vertical-align:middle;
	}
	#editPayOnLine .p-c-flexwrapper, #editQuickGetMoney .p-c-flexwrapper {
		display:flex;
		align-items:center;
		margin-bottom:16px;
		margin-right:16px;
	}
	
	#editPayOnLine1 .p-c-flexwrapper, #editQuickGetMoney .p-c-flexwrapper {
		display:flex;
		align-items:center;
		margin-bottom:16px;
		margin-right:16px;
	}
	#editPayOnLine .p-c-flexwrapper span, #editQuickGetMoney .p-c-flexwrapper span {
		width:110px;
		text-align: center;
	}
	
	#editPayOnLine1 .p-c-flexwrapper span, #editQuickGetMoney .p-c-flexwrapper span {
    width: 110px;
    text-align: center;
}
	#editPayOnLine .p-c-flexwrapper .form-control, #editQuickGetMoney .p-c-flexwrapper .form-control {
		width:200px;
	}
	
	#editPayOnLine1 .p-c-flexwrapper .form-control, #editQuickGetMoney .p-c-flexwrapper .form-control {
    width: 200px;
}
	#editPayOnLine .modal-body, #editQuickGetMoney .modal-body {
		display:flex;
		flex-wrap:wrap;
	}
	
	
	#editPayOnLine1 .modal-body, #editQuickGetMoney .modal-body {
		display:flex;
		flex-wrap:wrap;
	}
	.hiddenId-c {
		display:none;
	}
	.demo-list ul{
	
	display：block;
	width:100%;
	overflow:hidden;
	justify-content: center;
	align-items: center;
	font-size:14px;
	} 
	.demo-list ul li{
	    float:left;
	    width:15%;
	    margin-right:6px;
	     margin-top:6px;
	     margin-bottom:6px;
	    padding: 6px 12px;
	    border: 1px solid #ccc;
	    border-radius: 4px;
	}
	
	.demo-list ul li span{
		margin-left:10px;
	}
</style>
</head>
<body>	
<div class="div-c-init">
<button class="btn btn-primary" id="button-i-addNewZongDaiLi1-qbxz">全部选中</button>
<button class="btn btn-primary" id="button-i-addNewZongDaiLi1-qbqx">全部取消</button>
<button class="btn btn-primary" id="button-i-addNewZongDaiLi1-gxyn">更新页面</button>
</div>
<div class="div-c-table div-c-table-active" id="div-c-table1">
	<div class="demo-list clear">
        <ul class='demo-ul' style="float: left;">
        
        </ul>       		               		     		             	               		            			            		            	            		            	          	            		            	
	 </div>
</div>
<script type="text/javascript">
	var pageName=[];
	var pageDatas=[];
	var datas;
	$.ajax({
		 url:"/admin/findSystemUpdatePage.do",
		 type:"post",
		 data:{},
		success:function(data){
			datas=data.data;
			$(".demo-ul").empty()
			for(i=0;i<datas.length;i++){
				$(".demo-ul").append("<li><input data-page='"+datas[i].page+"' type='checkbox' value='"+datas[i].value+"'><span>"+datas[i].name+"</span></li>")
			}
		}
	})
	$("#button-i-addNewZongDaiLi1-qbxz").on("click",function(){  //全选中
		for(i=0;i<datas.length;i++){
			$(".demo-ul li").eq(i).find('input').prop("checked",true) 
		}
	})
	$("#button-i-addNewZongDaiLi1-qbqx").on("click",function(){  //全部取消
		for(i=0;i<datas.length;i++){
			$(".demo-ul li").eq(i).find('input').prop("checked",false) 
		}
	})
	var jsonstr = "[]"; //定义一个数组形式的JSON字符串
	var items = eval('(' + jsonstr + ')'); //转换为JSON 
	$("#button-i-addNewZongDaiLi1-gxyn").on("click",function(){    //更新
		for(i=0;i<datas.length;i++){
			if($(".demo-ul li").eq(i).find('input').is(':checked')==true){
				var page=$(".demo-ul li").eq(i).find('input').attr("data-page");
				$(".demo-ul li").eq(i).find('input').val(Number($(".demo-ul li").eq(i).find('input').val())+1)
				var num=$(".demo-ul li").eq(i).find('input').val()
				var item={page:page,value:num};
				items.push(item)
			}
		}
		$.ajax({
			 url:"/admin/updateSystemPageInfo.do",
			 type:"post",
			 data:{
				 page:JSON.stringify(items)
			 },
			success:function(data){
				for(i=0;i<datas.length;i++){
					$(".demo-ul li").eq(i).find('input').prop("checked",false) 
				}
				alert("更新成功!");
			}	
		})
	})
</script>
</body>
</html>